package com.fly.demo.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fly.demo.entity.User;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 00fly
 * @since 2018-09-11
 */
public interface UserDao extends BaseMapper<User>
{
    @Select("select * from user where id = #{value}")
    User findById(Long id);
    
    /**
     * 执行多条sql需配置allowMultiQueries=true
     */
    @Update("delete from user where id = #{user.id}; INSERT INTO `user`(id, username, password, create_date, age, name) VALUES ( #{user.id}, #{user.username}, #{user.password}, #{user.createDate}, #{user.age}, #{user.name});")
    int testInsert(@Param("user") User user);
}